package com.aji.alluser.controller;

import com.aji.allcommon.result.Result;
import com.aji.alluser.domain.Role;
import com.aji.alluser.service.RoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/role")
@Slf4j
@Api(tags = "角色相关接口")
@RequiredArgsConstructor
public class RoleController {

    private final RoleService roleService;

    @ApiOperation("获取所有角色")
    @GetMapping("/list")
    public Result list() {
        List<Role> roles = roleService.list(); // 查询所有角色
        return Result.success(roles);
    }
}
